function currTime(is_time) {
    let t = new Date(is_time),
        yearD = t.getFullYear(),
        monthD = t.getMonth() + 1,
        dayD = t.getDate(),
        hoursD = t.getHours(),
        minutesD = t.getMinutes();
    return yearD + '-' + monthD + '-' + dayD + '(' + hoursD + ':' + minutesD + ')';
}

class SeverityType {
    constructor(is_type, is_severityType) {
        this.is_type = is_type;
        this.is_severityType = is_severityType;
    }
    severityLevel() {
        let newText = '';
        for (let item in this.is_severityType) {
            if (item === this.is_type) {
                newText = this.is_severityType[item];
            }
        }
        return newText;
    }
}

function severityDataInit(is_oldData, is_severityColorInit) {
    const newData = [];
    is_oldData.forEach(item => {
        if (!item.severityColor) {
            for (let i in is_severityColorInit) {
                if (item.level === i) {
                    item.severityColor = is_severityColorInit[i];
                }
            }
        }
        newData.push(item);
    })
    return newData;
}
export {
    currTime,
    SeverityType,
    severityDataInit
}